<?php

class myUser extends sfBasicSecurityUser
{
	public function addUserNameToSession(User $user)
	{
		$this->setAttribute('isUserLogged', true);
		$this->setAttribute('user', $user);
	}
	public function deleteComanda()
	{
		$this->setAttribute('comanda',array());
	}
	
	public function setUnlogged()
	{
		$this->setAttribute('isUserLogged', false);
		$this->setAttribute('user',NULL);
		$this->setAttribute('comanda',array());
	}
	
	public function setLogged($value)
	{
		$this->setAttribute('isUserLogged', $value);
	}
	
	public function getCurrentUser()
	{
 		$user = $this->getAttribute('user');
 		return $user;
	}
	
	public function isUserLogged()
	{
 		return $this->getAttribute('isUserLogged');
	}
	
	public function setComanda($id_carte)
	{
		$comenzi = $this->getAttribute('comanda',array());
		array_unshift($comenzi,$id_carte);
		$this->setAttribute('comanda', array_slice($comenzi,0));
	}
}
